<?php

$name = $_GET['name'];
$price = $_GET['price'];
$num = $_GET['num'];

$con = mysqli_connect('localhost', 'root', 'root');
mysqli_select_db($con, '2004');
mysqli_query($con, "set charset 'utf8'");
mysqli_query($con, "set character set 'utf8'");
$sql = "insert into shop (name,price,num) values ('$name',$price,$num)";
$res = mysqli_query($con,$sql);
if($res){
     echo json_encode(array(
         "code" => 200,
         "body" => array(
             "msg" => "添加成功"
         )
         ));
}else{
    echo json_encode(array(
        "code" => 0,
        "body" => array(
            "msg" => "添加失败"
        )
        ));
}
?>